<template>
	<view class="grid_flex">
		<view class="grid_item_flex" v-for="(item,index) in iconList" :key="index" @click="jump(item.url)">
			<image class="grid_pic" :src="item.icon"></image>
			<view class="grid_text">{{item.name}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "navbar",
		data() {
			return {};
		},
		props: ['iconList'],
		methods: {
			jump(url) {
				if (url == "kefu") {
					wx.openCustomerServiceChat({
						extInfo: {
							url: vk.vuex.get('$app.appinfo.workwxurl'),
						},
						corpId: vk.vuex.get('$app.appinfo.workwxappid'),
						success(res) {
							调用客服成功
						}
					})
					return;
				}
				if (url == "/pages/index/index" || url == "/pages/Tabbar/my/my") {
					uni.switchTab({
						url: url
					})
					return;
				}

				if (url == "/pages/Tabbar/watching/watching" || url == "/pages/Tabbar/tj/tj") {
					uni.switchTab({
						url: url
					})
					return;
				}

				if (url == "/pages/index/index?path=record") {
					uni.reLaunch({
						url: url
					})
					return;
				}

				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss">
	.grid_flex {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		
	}

	.grid_item_flex {
		display: flex;
		flex-direction: column;
		align-items: center;
		border-radius: 50%;
		width: 200rpx;
		margin: 10rpx 20rpx 20rpx 20rpx;
	}

	.grid_pic {
		width: 90rpx;
		height: 90rpx;
	}

	.grid_text {
		font-size: 30rpx;
		color: #6b6b6b;
		margin-top: 10rpx;
	}
</style>
